/*
 *  Copyright (C) 2011 Glenn Rune Strandbråten
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package myrmidia.UI;

import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Collection;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import jcolibri.cbrcore.CBRCase;
import jcolibri.cbrcore.CBRQuery;
import jcolibri.method.retrieve.RetrievalResult;
import myrmidia.CBR.CBREngine;
import myrmidia.UI.Resources.MultipleResults;
import myrmidia.UI.Resources.UnitModel;
import myrmidia.UI.Resources.WindowCloser;
import myrmidia.Util.CollectionControl;
import myrmidia.Warhammer.Army;
import myrmidia.Warhammer.ArmyUnit;
import myrmidia.Warhammer.Case;

/**
 * User interface to display the retrieved results from the Query, and to
 * allow the user to approve which ones he would like to advance with
 * @author Glenn Rune Strandbråten
 * @version 1.0
 */
public class RetrievalUI extends javax.swing.JFrame implements MultipleResults{

    private int displaying = -1;
    private boolean[] approvedCases;
    private Collection<RetrievalResult> results = null;
    private CBRQuery query;

    /** Creates new form RetrievalUI */
    public RetrievalUI() {
        initComponents();
        init();
    }
    /**
     * Creates new form RetrievalUI
     * @param parent The JFrame parent
     * @param query  The CBRQuery used to get the results
     * @param results The collection of RetrievalResults from the query
     */
    public RetrievalUI(JFrame parent, Collection<RetrievalResult> results, CBRQuery query) {
        initComponents();
        setLocationRelativeTo(parent);
        this.query = query;
        this.results = results;
        init();
    }

    /**
     * Method which initializes variables and the unitTable popupMenu
     */
    private void init(){
        initApprovedCases();
        unitsTable.getTableHeader().setReorderingAllowed(false);
        unitsPanel.setVisible(false);
        setSize(getMinimumSize());
        if(results!=null)
            displayNextResult();
        addWindowListener(new WindowCloser());
        popupMenu = new javax.swing.JPopupMenu("View");
        popupView = new javax.swing.JMenuItem("View equipment/utility");
        popupView.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                viewButtonActionPerformed(e);
            }
        });
        popupMenu.add(popupView);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        navigationPane = new javax.swing.JPanel();
        previousCaseButton = new javax.swing.JButton();
        nextCaseButton = new javax.swing.JButton();
        displayCountLabel = new javax.swing.JLabel();
        displayInfoLabel = new javax.swing.JLabel();
        nextButton = new javax.swing.JButton();
        cancelButton = new javax.swing.JButton();
        unitsButton = new javax.swing.JToggleButton();
        explanationButton = new javax.swing.JButton();
        caseIDLabel = new javax.swing.JLabel();
        playerLabel = new javax.swing.JLabel();
        opponentLabel = new javax.swing.JLabel();
        pointLabel = new javax.swing.JLabel();
        outcomeLabel = new javax.swing.JLabel();
        caseIDTextLabel = new javax.swing.JLabel();
        playerTextLabel = new javax.swing.JLabel();
        opponentTextLabel = new javax.swing.JLabel();
        pointTextLabel = new javax.swing.JLabel();
        outcomeTextLabel = new javax.swing.JLabel();
        approveCheckBox = new javax.swing.JCheckBox();
        unitsPanel = new javax.swing.JPanel();
        viewButton = new javax.swing.JButton();
        unitsScroll = new javax.swing.JScrollPane();
        unitsTable = new myrmidia.UI.Resources.NoEditTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Myrmidia - Retrieved cases (armies)");
        setMinimumSize(new java.awt.Dimension(500, 245));

        navigationPane.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        previousCaseButton.setText("<");
        previousCaseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                previousCaseButtonActionPerformed(evt);
            }
        });

        nextCaseButton.setText(">");
        nextCaseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nextCaseButtonActionPerformed(evt);
            }
        });

        displayCountLabel.setText("1/1");

        displayInfoLabel.setText("Displaying case (army)");

        nextButton.setMnemonic('n');
        nextButton.setText("Next");
        nextButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nextButtonActionPerformed(evt);
            }
        });

        cancelButton.setMnemonic('c');
        cancelButton.setText("Cancel");
        cancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout navigationPaneLayout = new javax.swing.GroupLayout(navigationPane);
        navigationPane.setLayout(navigationPaneLayout);
        navigationPaneLayout.setHorizontalGroup(
            navigationPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(navigationPaneLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(previousCaseButton)
                .addGap(18, 18, 18)
                .addComponent(displayInfoLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(displayCountLabel)
                .addGap(17, 17, 17)
                .addComponent(nextCaseButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 240, Short.MAX_VALUE)
                .addComponent(cancelButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(nextButton)
                .addContainerGap())
        );
        navigationPaneLayout.setVerticalGroup(
            navigationPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, navigationPaneLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(navigationPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nextCaseButton)
                    .addComponent(displayInfoLabel)
                    .addComponent(previousCaseButton)
                    .addComponent(displayCountLabel)
                    .addComponent(nextButton)
                    .addComponent(cancelButton))
                .addContainerGap())
        );

        unitsButton.setMnemonic('u');
        unitsButton.setText("Show units");
        unitsButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                unitsButtonActionPerformed(evt);
            }
        });

        explanationButton.setMnemonic('e');
        explanationButton.setText("Get explanation");
        explanationButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                explanationButtonActionPerformed(evt);
            }
        });

        caseIDLabel.setText("Case id:");

        playerLabel.setText("Player race:");

        opponentLabel.setText("Opponent race:");

        pointLabel.setText("Army points:");
        pointLabel.setToolTipText("Shows the number of used army points over the number of available army points");

        outcomeLabel.setText("Outcome: ");

        caseIDTextLabel.setText("<placeholder>");

        playerTextLabel.setText("<placeholder>");

        opponentTextLabel.setText("<placeholder>");

        pointTextLabel.setText("<placeholder>");

        outcomeTextLabel.setText("<placeholder>");

        approveCheckBox.setMnemonic('a');
        approveCheckBox.setText("Approve case (army) for further use");
        approveCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                approveCheckBoxActionPerformed(evt);
            }
        });

        unitsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Units"));

        viewButton.setMnemonic('v');
        viewButton.setText("View equipment/utility");
        viewButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                viewButtonActionPerformed(evt);
            }
        });

        unitsTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Unit name", "Number of units"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.Integer.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        unitsTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                unitsTableMouseReleased(evt);
            }
        });
        unitsScroll.setViewportView(unitsTable);

        javax.swing.GroupLayout unitsPanelLayout = new javax.swing.GroupLayout(unitsPanel);
        unitsPanel.setLayout(unitsPanelLayout);
        unitsPanelLayout.setHorizontalGroup(
            unitsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, unitsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(unitsScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 452, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(viewButton))
        );
        unitsPanelLayout.setVerticalGroup(
            unitsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(unitsPanelLayout.createSequentialGroup()
                .addComponent(viewButton)
                .addContainerGap(228, Short.MAX_VALUE))
            .addComponent(unitsScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 251, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(navigationPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(playerLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(playerTextLabel)
                .addContainerGap(492, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(opponentLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(opponentTextLabel)
                .addContainerGap(474, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pointLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pointTextLabel)
                .addContainerGap(489, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(caseIDLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(caseIDTextLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 301, Short.MAX_VALUE)
                .addComponent(unitsButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(explanationButton)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(outcomeLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(outcomeTextLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 289, Short.MAX_VALUE)
                        .addComponent(approveCheckBox))
                    .addComponent(unitsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(navigationPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(explanationButton)
                    .addComponent(unitsButton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(caseIDLabel)
                    .addComponent(caseIDTextLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(playerLabel)
                    .addComponent(playerTextLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(opponentLabel)
                    .addComponent(opponentTextLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(pointLabel)
                    .addComponent(pointTextLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(outcomeLabel)
                    .addComponent(outcomeTextLabel)
                    .addComponent(approveCheckBox))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(unitsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * Action performed when the explanationButton is selected
     * @param evt The ActionEvent trigger
     */
    private void explanationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_explanationButtonActionPerformed
        new ExplanationUI(this, displaying, ExplanationUI.MODE_TRANSPARENCY).setVisible(true);
    }//GEN-LAST:event_explanationButtonActionPerformed

    /**
     * Action performed when the nextCaseButton is selected
     * @param evt The ActionEvent trigger
     */
    private void nextCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextCaseButtonActionPerformed
        displayNextResult();
    }//GEN-LAST:event_nextCaseButtonActionPerformed

    /**
     * Action performed when the previousCaseButton is selected
     * @param evt The ActionEvent trigger
     */
    private void previousCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_previousCaseButtonActionPerformed
        displayPreviousResult();
    }//GEN-LAST:event_previousCaseButtonActionPerformed

    /**
     * Action performed wheb the cancelButton is selected
     * @param evt The ActionEvent trigger
     */
    private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
        new SelectTaskUI(this).setVisible(true);
        dispose();
    }//GEN-LAST:event_cancelButtonActionPerformed

    /**
     * Action performed when the unitsButton is toggled
     * @param evt The ActionEvent trigger
     */
    private void unitsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unitsButtonActionPerformed
        if(unitsButton.isSelected()){
            if(getSize().height<500)
                setSize(new Dimension(getSize().width,500));
            unitsPanel.setVisible(true);
            unitsButton.setText("Hide units");
            populateUnitsTable();
        }
        else{
            unitsPanel.setVisible(false);
            unitsButton.setText("Show units");
        }
    }//GEN-LAST:event_unitsButtonActionPerformed

    /**
     * Action performed when the viewButton is selected
     * @param evt The ActionEvent trigger
     */
    private void viewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewButtonActionPerformed
        UnitModel model = UnitModel.parseUnitModelFromArmyUnit(getSelectedArmyUnit());
        new EquipmentUtilUI(this,model,true).setVisible(true);
    }//GEN-LAST:event_viewButtonActionPerformed

    /**
     * Action performed when the approveCheckBox is selected
     * @param evt The ActionEvent trigger
     */
    private void approveCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_approveCheckBoxActionPerformed
        if(approveCheckBox.isSelected())
            approvedCases[displaying] = true;
        else
            approvedCases[displaying] = false;
    }//GEN-LAST:event_approveCheckBoxActionPerformed

    /**
     * Action performed when the nextButton is selected
     * @param evt The ActionEvent trigger
     */
    private void nextButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextButtonActionPerformed
        if(verifyRequirements()){
            try{
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                Collection<RetrievalResult> approvedResults = new ArrayList<RetrievalResult>();
                int count = 0;
                for(RetrievalResult ret : results){
                    if(approvedCases[count++])
                        approvedResults.add(ret);
                }
                CBREngine cbrEngine = CBREngine.getInstance();
                Collection<CBRCase> reuse = cbrEngine.reuse(query, approvedResults);
                new ReviseUI(this, reuse).setVisible(true);
            }
            finally{
                setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                dispose();
            }
        }
        else
            JOptionPane.showMessageDialog(this, "At least one case (army) must be approved", "Error 04 - No approved case", JOptionPane.ERROR_MESSAGE);
    }//GEN-LAST:event_nextButtonActionPerformed

    /**
     * Action performed when a mouse click were performed inside the unitsTable
     * @param evt The MouseEvent trigger
     */
    private void unitsTableMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_unitsTableMouseReleased
        if(evt.isPopupTrigger()){
            int row = unitsTable.rowAtPoint(evt.getPoint());
            unitsTable.setRowSelectionInterval(row, row);
            popupMenu.show(unitsTable, evt.getX(), evt.getY());
        }
    }//GEN-LAST:event_unitsTableMouseReleased

    public final void displayNextResult(){
        displaying = (displaying==results.size()-1) ? 0 : displaying+1;
        displayResult();
    }
    
    public final void displayPreviousResult(){
        displaying = (displaying==0) ? results.size()-1 : displaying-1;
        displayResult();
    }

    public void displayResult(){
        RetrievalResult retrieval =
            (RetrievalResult)CollectionControl.getItemAt(results, displaying);
        Case _case = (Case) retrieval.get_case().getSolution();
        caseIDTextLabel.setText(""+_case.getID());
        playerTextLabel.setText(_case.getArmy().getPlayerRace().toString());
        opponentTextLabel.setText(_case.getOpponent().toString());
        pointTextLabel.setText(_case.getArmy().calculateCost()+"/"+
            _case.getArmy().getArmyPoints());
        outcomeTextLabel.setText(_case.getOutcome().toString());
        displayCountLabel.setText((displaying+1)+"/"+results.size());
        if(approvedCases[displaying])
            approveCheckBox.setSelected(true);
        else
            approveCheckBox.setSelected(false);
        if(unitsButton.isSelected())
            populateUnitsTable();
    }

    public void populateUnitsTable(){
        DefaultTableModel dtm = (DefaultTableModel) unitsTable.getModel();
        int rows = dtm.getRowCount();
        for(int i=rows-1; i>=0; i--)
            dtm.removeRow(i);
        RetrievalResult retrieval =
            (RetrievalResult)CollectionControl.getItemAt(results, displaying);
        Case _case = (Case) retrieval.get_case().getSolution();
        Army army = _case.getArmy();
        for(ArmyUnit unit : army.getArmyUnits()){
            int number = unit.getNumberOfUnits();
            String name = unit.getUnit().getName().split(":")[1];
            dtm.addRow(new Object[]{name,number});
        }
    }

    /**
     * Method to aquire the selected ArmyUnit from the unitsTable
     * @return The ArmyUnit at the selected row in the unitsTable
     */
    private ArmyUnit getSelectedArmyUnit(){
        RetrievalResult retrieval =
            (RetrievalResult)CollectionControl.getItemAt(results, displaying);
        Case _case = (Case) retrieval.get_case().getSolution();
        return (ArmyUnit) CollectionControl.getItemAt(
                _case.getArmy().getArmyUnits(), unitsTable.getSelectedRow());
    }

    /**
     * Method which initializes the array containing the booleans for
     * approved cases, all values are set to true by default
     */
    private void initApprovedCases() {
        if(results==null||results.isEmpty())
            approvedCases = new boolean[1];
        else
            approvedCases = new boolean[results.size()];
        for(int i=0; i<approvedCases.length; i++)
            approvedCases[i] = true;
    }

    /**
     * Method which verifies if the requirements are met, if any case is approved
     * the requirements are met.
     * @return true if any of the cases are approved - false if none of the cases
     * are approved
     */
    private boolean verifyRequirements() {
        for (boolean b : approvedCases) {
            if(b)
                return true;
        }
        return false;
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new RetrievalUI().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox approveCheckBox;
    private javax.swing.JButton cancelButton;
    private javax.swing.JLabel caseIDLabel;
    private javax.swing.JLabel caseIDTextLabel;
    private javax.swing.JLabel displayCountLabel;
    private javax.swing.JLabel displayInfoLabel;
    private javax.swing.JButton explanationButton;
    private javax.swing.JPanel navigationPane;
    private javax.swing.JButton nextButton;
    private javax.swing.JButton nextCaseButton;
    private javax.swing.JLabel opponentLabel;
    private javax.swing.JLabel opponentTextLabel;
    private javax.swing.JLabel outcomeLabel;
    private javax.swing.JLabel outcomeTextLabel;
    private javax.swing.JLabel playerLabel;
    private javax.swing.JLabel playerTextLabel;
    private javax.swing.JLabel pointLabel;
    private javax.swing.JLabel pointTextLabel;
    private javax.swing.JButton previousCaseButton;
    private javax.swing.JToggleButton unitsButton;
    private javax.swing.JPanel unitsPanel;
    private javax.swing.JScrollPane unitsScroll;
    private myrmidia.UI.Resources.NoEditTable unitsTable;
    private javax.swing.JButton viewButton;
    // End of variables declaration//GEN-END:variables
    private javax.swing.JPopupMenu popupMenu;
    private javax.swing.JMenuItem popupView;
}